#pragma once

#include <rtmp-server.h>
#include <flv-proto.h>
#include <flv-writer.h>

class rtmp {
	public:
		rtmp(void* socket);
		void rtmp_recv(const char* buf, size_t transferred);
		~rtmp();
	private:
		friend int send(void*param, const void* header, size_t len, const void* payload, size_t bytes);
		friend int onpublish(void* param, const char* app, const char* stream, const char* type);
		friend int onscript(void* param, const void* script, size_t bytes, uint32_t timestamp);
		friend int onvideo(void* param, const void* data, size_t bytes, uint32_t timestamp);
		friend int onaudio(void* param, const void* data, size_t bytes, uint32_t timestamp);

	private:
		static void* s_flv;
		rtmp_server_handler_t* mHandler;
		rtmp_server_t* mServer;

};
